<!--by ysf-->
<template>
  <div>
    <div
      class="left"
      :class="{ 'left-hide': leftHide }"
      ref="leftRef"
    >
      <div class="left-content">
        <div class="left-content-tag-t" />
        <div class="left-content-tag-b" />
        <div class="left-content-title">BIM模型管理</div>
        <div class="left-content-search">
          <Search
            v-model="keyword"
            @input="onSearchChange"
          />
        </div>
        <el-scrollbar class="left-content-tree">
          <Tree
            ref="tree"
            :filter="filterKeyword"
            :viewerId="defaultViewId"
            :treeTypeName="treeTypeName"
            :treeTypeId="treeTypeId"
            @checkedBimData="treeCheckedData"
            @clearData="clearData"
          />
        </el-scrollbar>
      </div>
      <div
        class="left-close"
        @click="leftHide = !leftHide"
      ></div>
      <div
        class="bar"
        @mousedown.prevent="handleLeftMouseDown"
      ></div>
    </div>
    <div
      class="bim-line-wrap-select"
      ref="bimLineRef"
      :style="bimStyle"
      v-show="stageList && stageList.length > 0"
    >
      <el-select
        v-model="showType"
        placeholder="请选择"
        style="width: 110px"
        popper-class="show-type"
        :popper-append-to-body="true"
      >
        <el-option label="BIM阶段" :value="0"></el-option>
        <el-option label="历史场景" :value="1"></el-option>
      </el-select>
    </div>
    <div
      class="bim-line-wrap"
      ref="bimLineRef"
      :style="bimStyle"
      v-if="stageList && stageList.length > 0"
      v-show="showType === 0"
    >
      <div
        class="line-item"
        v-for="item in stageList"
        :key="item.id"
        :class="{
          'is-disabled-item': item.disabled,
          'is-active-item': activeStage.id === item.id
        }"
        @click="
          !item.disabled ? stageClickHandle(item) : ''
        "
      >
        {{ item.name }}
      </div>
    </div>

    <div
      class="right"
      :class="{ 'right-hide': rightHide }"
      ref="rightRef"
    >
      <div class="bimNav-title">
        <div
          @click="toolItemClickHandle(item)"
          v-for="(item, index) in toolData"
          :key="index"
          :class="{
            'is-active': activeTool === item.value
          }"
        >
          {{ item.label }}
          <p class="line"></p>
        </div>
      </div>
      <component
        v-if="activeTool"
        :is="activeTool"
        :activeStage="activeStage"
        :bimNumber="bimNumber"
        @floorClick="handleFloorClick"
        @domainClick="handleDomainClick"
        :multiDetailData="multiDetailData"
        :multiDetailIndex="multiDetailIndex"
      />
      <div v-else>暂无数据！</div>
      <div
        class="right-close"
        @click="rightHide = !rightHide"
      ></div>
      <div
        class="bar"
        @mousedown.prevent="handleRightMouseDown"
      ></div>
    </div>
  </div>
</template>

<script>
import Search from '@/components/search'
import Property from './components/property'
import Device from './components/device'
import Domain from './components/domain'
import Properties from './components/properties'
import Legend from './components/legend'
import Tree from '@/components/tree'
import QueryResult from '@/components/queryResult'
import { getAction } from '@/utils/helper'
import New from '@/utils/new'

let _viewer, _layerManager

export default {
  name: 'BIM',
  inject: ['viewerId'],
  components: {
    Search,
    Tree,
    QueryResult,
    Property,
    Device,
    Domain,
    Properties,
    Legend
  },
  data() {
    return {
      leftX: '',
      leftWidth: '',
      rightX: '',
      rightWidth: '',
      // 当前服务类型
      treeTypeName: 'BIM',
      treeTypeId: '2',
      // 关键词 前端过滤树形结构
      keyword: '',
      filterKeyword: '',
      // 隐藏侧边
      leftHide: false,
      rightHide: true,
      multiDetailData: [],
      multiDetailIndex: -1,
      options: [],
      value: '',
      queryResultData: undefined,
      layerCamera: {},
      bimStyle: {
        visibility: 'hidden',
        marginLeft: 0
      },
      selectLayer: null, // 树选择
      selectLayerId: null,
      isFirstChangeStage: true, // 是否第一次阶段切换
      stageList: [],
      activeStage: {},
      toolData: [
        {
          label: '资产信息',
          value: 'Property'
        },
        {
          label: '监测设备',
          value: 'Device'
        },
        {
          label: '功能分区',
          value: 'Domain'
        },
        {
          label: '属性',
          value: 'Properties'
        },
        {
          label: '图例',
          value: 'Legend'
        }
      ],
      activeTool: 'Property',
      showType: 1,
      // 配置的资产id
      bimNumber: ''
    }
  },
  computed: {
    defaultViewId() {
      return this.$store.state.layer.defaultViewId
    }
  },
  watch: {
    activeStage: {
      handler(newVal, oldVal) {
        // console.log('active', newVal);
        if (oldVal) {
          // this._layerManager.del(oldVal.pkid)
        }
        if (newVal) {
          if (!this.isFirstChangeStage) {
            _layerManager.add(newVal)
          }
          // //阶段切换时，保持树节点选中
          setTimeout(() => {
            if (this.$refs.tree) {
              this.$refs.tree.setNodeChecked(newVal.pkid)
            }
          })
        }
      },
      deep: true
    },
    showType(newVal) {
      if (!newVal) {
        New.$emit('show', false)
      } else {
        New.$emit('show', true)
      }
    }
  },
  async created() {
    const { layerManager, viewer } = await getAction(
      this.defaultViewId
    )
    _layerManager = layerManager
    _viewer = viewer

    // layerManager删除回调
    this.$bus.$on('handleBimDel', () => {
      this.clearData()
    })

    this.$bus.$on('togglePanel', (flag) => {
      this.leftHide = flag
    })

    this.$bus.$on(
      'handleDetailData',
      (flag, data, index) => {
        if (flag) {
          this.rightHide = false
          this.multiDetailData = data
          this.multiDetailIndex = index
          this.activeTool = 'Properties'
          // this.rightTabActiveName = 'properties'
        } else {
          this.multiDetailData = []
          this.multiDetailIndex = -1
          this.activeTool = 'Property'
          // this.rightTabActiveName = 'statistics'
        }
      }
    )

    this.$bus.$on('modelSearchCode', (bimNumber) => {
      this.bimNumber = bimNumber
    })
  },
  methods: {
    onSearchChange(newValue) {
      this.filterKeyword = newValue
    },
    // 树点击回调
    treeCheckedData(data) {
      // console.log('treeCheckedData', data);
      if (data && data.length > 0) {
        // 选择
        const bimTreeData = data[0]
        this.dealStageList(bimTreeData)
        // //树单选
        // if (data.length > 1 && this.selectLayerId) {//清除树上一个选择
        //   let selectLayerIndex = data.findIndex((item) => item.pkid == this.selectLayerId);
        //   let index = selectLayerIndex == 0 ? 1 : 0;
        //   bimTreeData = data[index];
        //   setTimeout(() => {
        //     this._layerManager.del(this.selectLayerId);
        //   })
        //   // console.log('bimTreeData', selectLayerIndex);
        // } else {
        //   bimTreeData = data[0]
        // }
        // this.dealStageList(bimTreeData);
      } else {
        this.clearData()
      }
    },
    // 处理阶段
    dealStageList(bimTreeData) {
      const layerList = JSON.parse(bimTreeData.serviceUrl)
      // 查找树渲染的图层
      const activeStageIndex = layerList.findIndex(
        (item) => item.serviceType && item.serviceUrl
      )
      const selectLayer = layerList[activeStageIndex]
      // 处理阶段
      const stageList = layerList.map((item, index) => {
        item.id = 'BIM' + index
        item.stageId = 'BIM' + index
        item.layerId = bimTreeData.pkid
        // item.pkid = 'BIM' + index;
        item.pkid = bimTreeData.pkid
        item.title = 'BIM' + index
        item.name = 'BIM' + index
        item.sourceName = bimTreeData.sourceName
        item.from = bimTreeData.from
        item.serviceType = bimTreeData.serviceType
        item.bimType = bimTreeData.bimType
        item.disabled = !item.serviceUrl
        return item
      })
      this.selectLayer = selectLayer
      this.selectLayerId = bimTreeData.pkid
      this.stageList = stageList
      if (this.stageList && this.stageList.length > 0) {
        this.showType = 0
      }
      this.activeStage = stageList[activeStageIndex]
      this.isFirstChangeStage = true
      this.setBimStyle()
      this.setRightActiveTool()
    },
    // 清除数据
    clearData() {
      this.selectLayer = null
      this.selectLayerId = undefined
      this.stageList = []
      this.showType = 1
      New.$emit('show', true)
      this.activeStage = {}
      this.isFirstChangeStage = true
      this.activeTool = ''
      this.rightHide = true
      this.multiDetailData = []
      this.multiDetailIndex = -1
      this.bimNumber = ''
    },
    // 阶段点击
    stageClickHandle(data) {
      // console.log('stageClickHandle', data, this.activeStage);
      if (data.id === this.activeStage.id) return
      this.activeStage =
        this.activeStage && this.activeStage.id === data.id
          ? undefined
          : data
      this.setRightActiveTool()
      // //第一次阶段切换,移除bim树添加的图层
      if (this.isFirstChangeStage) {
        // console.log('isFirstChangeStage', this.isFirstChangeStage);
        this.isFirstChangeStage = false
        _layerManager.del(this.selectLayerId)
        // let selectLayer = this._layerManager._layers.get(this.selectLayerId);
        // // this._layerManager._layers.delete(this.selectLayerId);
        // // console.log('first', this._layerManager._layers)
        // let name = selectLayer.name; //主图层隐藏
        // name.forEach((item) => {
        //   this._viewer.scene.layers.remove(item)
        // })
      } else {
        _layerManager.del(this.selectLayerId)
      }
    },
    // 右侧工具栏
    setRightActiveTool() {
      this.activeTool = 'Property'
    },
    // 阶段UI显示
    setBimStyle() {
      this.$nextTick(() => {
        if (this.$refs.bimLineRef) {
          this.bimStyle = {
            marginLeft: `-${
              this.$refs.bimLineRef.clientWidth / 2
            }px`,
            visibility: 'visible'
          }
        }
      })
    },
    // 右侧工具栏点击
    toolItemClickHandle(data) {
      const { value } = data
      this.activeTool =
        this.activeTool === value ? undefined : value
      this.clearLayerStyle() // 清除楼样式
      // console.log('toolItemClickHandle', data)
    },
    // 楼层点击回调
    handleFloorClick(item) {
      const value = item.floorName
      const activeStage = this.activeStage
      // console.log('handleFloorClick', item, activeStage)
      if (!activeStage) return
      if (
        !activeStage.dataService ||
        activeStage.dataService === ''
      ) {
        // this.$message('没有挂载数据源,暂无图层效果');
        return
      }
      this.getFloorGroup(value, activeStage)
    },
    // 查询楼层组件
    getFloorGroup(value, selLayer) {
      let { dataService } = selLayer
      dataService = decodeURI(dataService)
      // dataService = 'http://101.254.248.164:8090/iserver/services/data-ChengDu_bim2/rest/data/datasources/bimfortest2';
      const arr = dataService.split('/datasources/')
      const dataUrl = arr[0]
      const dataSource = arr[1]
      // console.log('dataService', dataUrl, dataSource);
      // const viewerLayerData = this._viewer.scene._layers._layers._array;
      // console.log('getFloorGroup', this._layerManager._layers.get(this.activeStage.pkid));
      const viewerLayerData = _layerManager._layers.get(
        this.activeStage.pkid
      ).layer
      viewerLayerData.forEach((v) => {
        const { _name } = v
        v.releaseSelection()
        v.removeAllObjsColor()
        if (value === '0') return
        const newName = _name.split('@')
        v.setQueryParameter({
          url: dataUrl,
          dataSourceName: dataSource,
          dataSetName: newName[0]
        })
        // 查询所在图层组件
        const queryParameters =
          new SuperMap.GetFeaturesBySQLParameters({
            queryParameter: {
              name: newName[0],
              attributeFilter: `FLOOR_NUMBER ='${value}'`,
              fields: ['SmID']
            },
            toIndex: -1,
            maxFeatures: 99999,
            datasetNames: [`${dataSource}:${newName[0]}`],
            hasGeometry: false
          })
        L.supermap
          .featureService(v.queryParameter.url)
          .getFeaturesBySQL(queryParameters, (res) => {
            const SmIDArray = []
            console.log('sql', res)
            res.result.features.features.forEach((e) => {
              SmIDArray.push(e.properties.SmID)
            })
            this.setFloorGroupStyle(
              v,
              SmIDArray,
              newName[0],
              dataSource
            )
          })
      })
    },
    // 设置楼层组件样式
    setFloorGroupStyle(v, SmIDArray, name, dataSource) {
      // 查询所有组件
      const targetQueryParameters =
        new SuperMap.GetFeaturesBySQLParameters({
          queryParameter: {
            name: name,
            fields: ['SmID']
          },
          toIndex: -1,
          maxFeatures: 99999,
          datasetNames: [`${dataSource}:${name}`],
          hasGeometry: false
        })
      L.supermap
        .featureService(v.queryParameter.url)
        .getFeaturesBySQL(targetQueryParameters, (res) => {
          const allSmIDArray = []
          res.result.features.features.forEach((e) => {
            allSmIDArray.push(e.properties.SmID)
          })
          const xorArrayData = _.xor(
            SmIDArray,
            allSmIDArray
          )
          v.setObjsColor(
            xorArrayData,
            new Cesium.Color(255, 255, 255, 0)
          )
        })
    },
    // 功能区选择回调
    handleDomainClick(item) {
      const value = item.name
      const activeStage = this.activeStage
      // console.log('handleDomainClick', value, activeStage)
      if (!activeStage) return
      if (
        !activeStage.dataService ||
        activeStage.dataService === ''
      ) {
        // this.$message('没有挂载数据源,暂无图层效果');
        return
      }
      this.getDomainGroup(value, activeStage)
    },
    // 查询楼层组件
    getDomainGroup(value, selLayer) {
      let { dataService } = selLayer
      dataService = decodeURI(dataService)
      // dataService = 'http://101.254.248.164:8090/iserver/services/data-ChengDu_bim2/rest/data/datasources/bimfortest2';
      const arr = dataService.split('/datasources/')
      const dataUrl = arr[0]
      const dataSource = arr[1]
      // console.log('dataService', dataService, dataUrl, dataSource);
      // const viewerLayerData = this._viewer.scene._layers._layers._array;
      const viewerLayerData = _layerManager._layers.get(
        this.activeStage.pkid
      ).layer
      viewerLayerData.forEach((v) => {
        const { _name } = v
        v.releaseSelection()
        v.removeAllObjsColor()
        if (value === '0') return
        const newName = _name.split('@')
        v.setQueryParameter({
          url: dataUrl,
          dataSourceName: dataSource,
          dataSetName: newName[0]
        })
        // 查询所在图层组件
        const queryParameters =
          new SuperMap.GetFeaturesBySQLParameters({
            queryParameter: {
              name: newName[0],
              attributeFilter: `TYPE ='${value}'`,
              fields: ['SmID']
            },
            toIndex: -1,
            maxFeatures: 99999,
            datasetNames: [`${dataSource}:${newName[0]}`],
            hasGeometry: false
          })
        L.supermap
          .featureService(v.queryParameter.url)
          .getFeaturesBySQL(queryParameters, (res) => {
            const SmIDArray = []
            console.log('sql', res)
            res.result.features.features.forEach((e) => {
              SmIDArray.push(e.properties.SmID)
            })
            this.setFloorGroupStyle(
              v,
              SmIDArray,
              newName[0],
              dataSource
            )
          })
      })
    },
    // 清除图层样式
    clearLayerStyle() {
      const activeStage = this.activeStage
      if (!activeStage) return
      const viewerLayerData =
        _viewer.scene._layers._layers._array
      viewerLayerData.forEach((v) => {
        // v.releaseSelection()
        v.removeAllObjsColor()
      })
    },
    handleLeftMouseDown(e) {
      this.leftX = e.clientX
      this.leftWidth = this.$refs.leftRef.offsetWidth
      document.documentElement.addEventListener(
        'mousemove',
        this.leftMove
      )
      document.documentElement.addEventListener(
        'mouseup',
        this.leftEnd
      )
    },
    leftMove(e) {
      let width = this.leftWidth + e.clientX - this.leftX
      width = width >= 500 ? 500 : width < 282 ? 282 : width
      this.$refs.leftRef.style['min-width'] = `${width}px`
      this.$refs.leftRef.style.setProperty(
        '--scroll-width',
        `${-(width - 47 - 1)}px`
      )
    },
    leftEnd() {
      document.documentElement.removeEventListener(
        'mousemove',
        this.leftMove
      )
      document.documentElement.removeEventListener(
        'mouseup',
        this.leftEnd
      )
    },
    handleRightMouseDown(e) {
      this.rightX = e.clientX
      this.rightWidth = this.$refs.rightRef.offsetWidth
      document.documentElement.addEventListener(
        'mousemove',
        this.rightMove
      )
      document.documentElement.addEventListener(
        'mouseup',
        this.rightEnd
      )
    },
    rightMove(e) {
      let width =
        this.rightWidth + (this.rightX - e.clientX)
      width = width >= 500 ? 500 : width < 400 ? 400 : width
      this.$refs.rightRef.style['min-width'] = `${width}px`
      this.$refs.rightRef.style.setProperty(
        '--scroll-width',
        `${-(width - 47 - 1)}px`
      )
    },
    rightEnd() {
      document.documentElement.removeEventListener(
        'mousemove',
        this.rightMove
      )
      document.documentElement.removeEventListener(
        'mouseup',
        this.rightEnd
      )
    }
  },
  beforeDestroy() {
    // 移除选中图层
    // if (this.activeStage) {
    //   this._layerManager.del(this.activeStage.pkid)
    // }
    this.clearData()
  }
}
</script>

<style lang="scss" scoped>
.left {
  position: fixed;
  left: 48px;
  top: 60px;
  width: 282px;
  height: calc(100% - 60px);
  padding: 10px 0;
  background: linear-gradient(
    90deg,
    rgba(25, 47, 61, 0.85),
    rgba(25, 47, 61, 0.1)
  );
  transition: width 1s;
  --scroll-width: -234px;

  &-content {
    width: 100%;
    overflow-x: hidden;
    height: 100%;
    position: relative;

    &-tag {
      &-t {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 5px;

        &::before,
        &::after {
          content: '';
          width: 0;
          height: 0;
          position: absolute;
          top: 0;
        }

        &::before {
          left: 0;
          border-top: 4px solid #fff;
          border-right: 4px solid transparent;
        }

        &::after {
          right: 0;
          border-top: 4px solid #fff;
          border-left: 4px solid transparent;
        }
      }

      &-b {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 5px;

        &::before,
        &::after {
          content: '';
          width: 0;
          height: 0;
          position: absolute;
          bottom: 0;
        }

        &::before {
          left: 0;
          border-bottom: 4px solid #fff;
          border-right: 4px solid transparent;
        }

        &::after {
          right: 0;
          border-bottom: 4px solid #fff;
          border-left: 4px solid transparent;
        }
      }
    }

    &-title {
      height: 50px;
      line-height: 50px;
      padding-left: 14px;
      font-size: 18px;
      font-weight: 800;
      color: #00d2ff;
      word-break: keep-all;
      border-top: 1px solid rgba(255, 255, 255, 0.2);
      border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }

    &-search {
      height: 30px;
      width: calc(100% - 16px);
      margin: 10px auto;
    }

    &-tree {
      border-bottom: 1px solid rgba(255, 255, 255, 0.2);
      margin: 0 8px;
      height: calc(100% - 50px - 50px);

      ::v-deep {
        // tree 背景色
        .el-tree {
          background-color: transparent;
        }

        //一级菜单无选择框
        .el-tree
          > .el-tree-node
          > .el-tree-node__content
          .el-checkbox {
          display: none;
        }

        // 节点选中颜色
        .el-tree-node:focus > .el-tree-node__content {
          background-color: rgba(255, 255, 255, 0.4);
        }

        // 节点样式
        .el-tree-node__content {
          position: relative;
          padding: 4px 0;
          box-sizing: content-box;
          height: auto;
          // 节点hover
          &:hover {
            background-color: rgba(255, 255, 255, 0.4);
          }

          // checkbox移动到右边
          /*& > label.el-checkbox {*/
          /*  position: absolute;*/
          /*  right: 0;*/
          /*}*/
        }

        .el-tree-node__expand-icon {
          font-size: 10px;
        }

        // checkbox样式
        .el-checkbox__inner {
          width: 12px;
          height: 12px;
          border: 1px solid rgba(255, 255, 255, 0.7);
          background: rgba(255, 255, 255, 0.3);
        }

        // 节点文字
        .el-tree-node__label {
          font-size: 14px;
          font-weight: 800;
          color: #ffffff;
          padding-right: 40px;
          white-space: normal;
          max-width: 200px;
        }

        // 二级节点文字
        .el-tree-node__children .el-tree-node__label {
          font-weight: 500;
          color: #d2e6f0;
        }

        // scrollbar横向滚动条
        .el-scrollbar__wrap {
          overflow-x: hidden;
        }
      }
    }
  }

  &-hide {
    //width: 0;
    left: var(--scroll-width);

    & > .left-close {
      background-color: red;

      &::before,
      &::after {
        transform-origin: 6px 1px;
      }
    }
  }

  &-close {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 44px;
    cursor: pointer;
    background: #192f3d;
    opacity: 0.7;

    &::before,
    &::after {
      content: '';
      position: absolute;
      width: 7px;
      height: 2px;
      background: #fff;
      top: 50%;
      left: 50%;
      transform-origin: 1px 1px;
    }

    &::before {
      transform: translateX(-50%) translateY(-50%)
        rotateZ(-45deg);
    }

    &::after {
      transform: translateX(-50%) translateY(-50%)
        rotateZ(45deg);
    }
  }

  .bar {
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    cursor: col-resize;
  }
}

.bim-tool {
  position: fixed;
  left: 340px;
  top: 70px;
  width: 48px;
  max-height: calc(100vh - 60px);
  background: linear-gradient(
    0deg,
    rgba(25, 47, 61, 0.85),
    rgba(25, 47, 61, 0.1)
  );
  transition: left 1s;
}

.bim-tool.hidden-left-tool {
  left: 58px;
}

.attribute-panel {
  position: fixed;
  right: 58px;
  bottom: 16px;
  width: 400px;
  height: 450px;
}

.right {
  position: fixed;
  right: 48px;
  top: 60px;
  width: 400px;
  height: calc(100% - 60px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(
    90deg,
    rgba(25, 47, 61, 0.1),
    rgba(25, 47, 61, 0.85)
  );
  transition: width 1s;
  --scroll-width: -352px;

  ::v-deep {
    // scrollbar横向滚动条
    .el-scrollbar__wrap {
      overflow-x: hidden;
    }
  }

  &-content {
    width: calc(100% - 32px);
    height: 100%;
    margin: 20px auto;

    &-title:not(:first-child) {
      padding-top: 26px;
      border-top: 1px solid rgba(255, 255, 255, 0.2);
    }

    &-title {
      padding-bottom: 10px;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      background: url('../../../assets/bim/bim_right_top@2x.png');

      &-l {
        width: 4px;
        height: 12px;
        background: linear-gradient(0deg, #bcf8ff, #40ebff);
        border-radius: 0 0 0 0;
        margin-right: 10px;
      }

      &-r {
        word-break: keep-all;
        font-size: 14px;
        font-weight: 800;
        background: linear-gradient(
          0deg,
          #bcf8ff 0%,
          #40ebff 100%
        );
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
      }
    }

    &-echart {
      width: 100%;
      padding: 10px 0;
    }

    &-query {
      display: flex;
      align-items: center;
      justify-content: space-between;

      & span {
        word-break: keep-all;
        font-size: 14px;
        font-weight: 400;
        color: #ffffff;
      }

      ::v-deep {
        .el-input__inner {
          background-color: transparent;
          border: 1px solid rgba(255, 255, 255, 0.4);
          border-radius: 0;
          height: 30px;
          line-height: 30px;
        }

        .el-input__icon {
          line-height: 30px;
        }
      }
    }
  }

  &-hide {
    //right: -402px;
    right: var(--scroll-width);

    & > .right-close {
      background-color: red;

      &::before,
      &::after {
        transform-origin: 1px 1px;
      }
    }
  }

  &-close {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 44px;
    cursor: pointer;
    background: #192f3d;
    opacity: 0.7;

    &::before,
    &::after {
      content: '';
      position: absolute;
      width: 7px;
      height: 2px;
      background: #fff;
      top: 50%;
      left: 50%;
      transform-origin: 6px 1px;
    }

    &::before {
      transform: translateX(-50%) translateY(-50%)
        rotateZ(-45deg);
    }

    &::after {
      transform: translateX(-50%) translateY(-50%)
        rotateZ(45deg);
    }
  }

  .bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 100%;
    cursor: col-resize;
  }
}
.bim-line-wrap-select {
  position: fixed;
  min-width: 80px;
  bottom: 52px;
  left: 45%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  // visibility: hidden;
}
.bim-line-wrap {
  position: fixed;
  min-width: 80px;
  bottom: 24px;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  visibility: hidden;
}

.line-item {
  position: relative;
  width: 98px;
  height: 98px;
  line-height: 98px;
  cursor: pointer;
  color: white;
  font-weight: bold;
  margin-left: 24px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url('../../../assets/images/weixuanzhong.png');
  background-size: 100% 100%;
  font-size: 16px;

  &:first-child {
    margin-left: 0;
  }

  &:last-child {
    &:after {
      display: none;
    }
  }

  &.is-active-item {
    background: url('../../../assets/images/xuanzhong.png');
  }

  &.is-disabled-item {
    color: #d8ded3;
    cursor: not-allowed;
    opacity: 0.6;
  }

  &:after {
    position: absolute;
    height: 2px;
    width: 56px;
    content: ' ';
    top: calc(50% - 1px);
    left: 80px;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
    background: linear-gradient(
      to right,
      rgba(0, 210, 255, 1),
      rgba(0, 210, 255, 0.6),
      rgba(0, 210, 255, 1)
    );
  }
}

.bimNav {
  &-title {
    padding-bottom: 10px;
    display: flex;
    background: url('../../../assets/bim/bim_right_top@2x.png');
    height: 40px;
    line-height: 40px;

    > div {
      margin-right: 20px;
      /*padding-bottom: 10px;*/
      cursor: pointer;
      font-size: 14px;
      font-family: PingFang SC;
      font-weight: bold;
      color: #d2e6f0;

      &:first-child {
        margin-left: 36px;
      }
    }

    .is-active {
      color: rgba(26, 217, 255, 1);

      .line {
        width: 50%;
        margin-top: 5px;
        margin-left: 25%;
        height: 3px;
        background: #00d2ff;
        border-radius: 2px;
      }
    }
  }
}
::v-deep {
  .el-input__inner {
    background: none
      url('../../../assets/img/select@2x.png');
    background-size: 100% 100%;
    color: white;
    border: 0 solid #4a80a3;
  }
  .el-select-dropdown {
    border-color: #4a80a3;

    .el-select-dropdown__empty {
      background-color: #4a80a3;
      color: white;
    }

    .el-select-dropdown__list {
      background-color: #4a80a3;

      .el-select-dropdown__item {
        color: white;
        background-color: #4a80a3;

        &.selected {
          color: white;
        }

        &.hover {
          background-color: #28516c;
        }
      }
    }

    .popper__arrow {
      border-bottom-color: #4a80a3;

      &::after {
        border-bottom-color: #4a80a3;
      }
    }
  }
  .el-popper[x-placement^='top'] .popper__arrow::after {
    border-top-color: #4a80a3;
    // border-color:#4a80a3
  }
}
</style>
